package com.snap.vseries.ui.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

public class SampleItemDecoration2 extends RecyclerView.ItemDecoration {

    private int spanCount;

    public SampleItemDecoration2(int spanCount) {
        this.spanCount = spanCount;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = parent.getChildAdapterPosition(view);
        if (position == RecyclerView.NO_POSITION) return;
//        if (position % spanCount == 0) {
//            outRect.left = 18;
//            outRect.right = 10;
//        } else if (position % spanCount % 2 == 0) {
//            outRect.left = 8;
//            outRect.right = 20;
//        } else {
//            outRect.left = 20;
//            outRect.right = 8;
//        }

//        outRect.left = 8;
//        outRect.right = 8;

        if (position < spanCount) {
            outRect.bottom = 20;
        } else {
            outRect.bottom = 16;
        }
    }
}
